﻿<%@ Page Title="" Language="C#" MasterPageFile="~/AdminPanel/AdminSite.Master" AutoEventWireup="true" CodeBehind="BookingFullView.aspx.cs" Inherits="FastTrackCabService.AdminPanel.BookingFullView" %>
<%@ Import Namespace="BusinessLogicLayer" %>
<%@ Import Namespace="BusinessObjects" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link href="../Style/FullView.css" rel="stylesheet" type="text/css"/>
    <style>
        .detailsView table:last-child th { padding: 0.5em; }

        .detailsView table:last-child td { width: auto; }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:DetailsView ID="dvPickAndDrop" Visible="False" CssClass="detailsView" runat="server"
                     AutoGenerateRows="False" CellPadding="4" ForeColor="#333333" GridLines="None"
                     HeaderText="Booking details">
        <AlternatingRowStyle BackColor="White" ForeColor="#284775"/>
        <CommandRowStyle BackColor="#E2DED6" Font-Bold="True"/>
        <EditRowStyle BackColor="#999999"/>
        <FieldHeaderStyle BackColor="#E9ECF1" Font-Bold="True"/>
        <Fields>
            <asp:BoundField DataField="BookingId" HeaderText="Booking Id" SortExpression="BookingId"/>
            <asp:TemplateField HeaderText="Customer" SortExpression="CustomerId">
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# "<a href=\"CustomerFullView.aspx?cusId=" + Eval("CustomerId") + "\">" + CustomerBLL.GetCustomerName(Convert.ToInt32(Eval("CustomerId"))) + "</a>" %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="BookedDateTime" HeaderText="Booked date &amp; time" SortExpression="BookedDateTime"/>
            <asp:BoundField DataField="OriginDateTime" HeaderText="Pickup date &amp; time" SortExpression="OriginDateTime"/>
            <asp:TemplateField HeaderText="From">
                <ItemTemplate>
                    <asp:DetailsView ID="DetailsView2" Style="width: 100%;" CssClass="innerDetailsView"
                                     runat="server" CellPadding="4" DataSource='<%# new List<CurrentLocation> {(CurrentLocation) Eval("OriginLocation")} %>'
                                     ForeColor="#333333" GridLines="None" Height="50px" Width="125px" AutoGenerateRows="False">
                        <AlternatingRowStyle BackColor="White" ForeColor="#284775"/>
                        <CommandRowStyle BackColor="#E2DED6" Font-Bold="True"/>
                        <EditRowStyle BackColor="#999999"/>
                        <FieldHeaderStyle BackColor="#E9ECF1" Font-Bold="True"/>
                        <Fields>
                            <asp:BoundField DataField="HomeNumberOrName" HeaderText="No / Name"/>
                            <asp:BoundField DataField="Street" HeaderText="Street"/>
                            <asp:BoundField DataField="City" HeaderText="City"/>
                            <asp:TemplateField HeaderText="District">
                                <ItemTemplate>
                                    <asp:Label ID="Label1" runat="server" Text='<%# DistrictBLL.GetDistrict(Convert.ToByte(Eval("DistrictId"))) %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Fields>
                        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White"/>
                        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White"/>
                        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center"/>
                        <RowStyle BackColor="#F7F6F3" ForeColor="#333333"/>
                    </asp:DetailsView>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="MidPoint" HeaderText="To" SortExpression="MidPoint"/>
            <asp:BoundField DataField="Type" HeaderText="Type" SortExpression="Type"/>
            <asp:BoundField DataField="Status" HeaderText="Status" SortExpression="Status"/>
            <asp:TemplateField HeaderText="Supervisor">
                <ItemTemplate>
                    <%# Eval("SupervisorId") == null ? "-" : "<a href='SupervisorFullView.aspx?staffId=" + Eval("SupervisorId") + "'>" + StaffBLL.GetStaffById(Convert.ToInt32(Eval("SupervisorId"))).FirstName + "</a>" %>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Vehicle(s)">
                <ItemTemplate>
                    <asp:GridView ID="GridView1" runat="server" DataSource='<%# Eval("VehicleDrivers") %>'
                                  AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333" GridLines="None">
                        <AlternatingRowStyle BackColor="White" ForeColor="#284775"/>
                        <Columns>
                            <asp:TemplateField HeaderText="Vehicle">
                                <ItemTemplate>
                                    <%# Eval("VehicleRegistrationNo") == null ? "-" : "<a href='VehicleFullView.aspx?regNo=" + Eval("VehicleRegistrationNo") + "'>" + Eval("VehicleRegistrationNo") + "</a>" %>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Type">
                                <ItemTemplate>
                                    <%# Eval("VehicleRegistrationNo") == null ? "-" : VehicleBLL.GetVehiclesByRegNo(Eval("VehicleRegistrationNo").ToString()).Type %>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Driver">
                                <ItemTemplate>
                                    <%# Eval("DriverId") == null ? "-" : "<a href='DriverFullView.aspx?staffId=" + Eval("DriverId") + "'>" + StaffBLL.GetStaffById(Convert.ToInt32(Eval("DriverId"))).FirstName + "</a>" %>
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                        <EditRowStyle BackColor="#999999"/>
                        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White"/>
                        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White"/>
                        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center"/>
                        <RowStyle BackColor="#F7F6F3" ForeColor="#333333"/>
                        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333"/>
                        <SortedAscendingCellStyle BackColor="#E9E7E2"/>
                        <SortedAscendingHeaderStyle BackColor="#506C8C"/>
                        <SortedDescendingCellStyle BackColor="#FFFDF8"/>
                        <SortedDescendingHeaderStyle BackColor="#6F8DAE"/>
                    </asp:GridView>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="TravelledDistance" HeaderText="Travelled Distance"
                            SortExpression="TravelledDistance" NullDisplayText="-"/>
            <asp:BoundField DataField="DeliveredDateTime"
                            HeaderText="Delivered date & time" SortExpression="DeliveredDateTime"
                            NullDisplayText="-"/>
            <asp:BoundField DataField="ReturnedDateTime" HeaderText="Returned date & time"
                            SortExpression="ReturnedDateTime" NullDisplayText="-"/>
        </Fields>
        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White"/>
        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White"/>
        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center"/>
        <RowStyle BackColor="#F7F6F3" ForeColor="#333333"/>
    </asp:DetailsView>
    <asp:DetailsView ID="dvPick" Visible="False" CssClass="detailsView" runat="server"
                     AutoGenerateRows="False" CellPadding="4" ForeColor="#333333" GridLines="None"
                     HeaderText="Booking details">
        <AlternatingRowStyle BackColor="White" ForeColor="#284775"/>
        <CommandRowStyle BackColor="#E2DED6" Font-Bold="True"/>
        <EditRowStyle BackColor="#999999"/>
        <FieldHeaderStyle BackColor="#E9ECF1" Font-Bold="True"/>
        <Fields>
            <asp:BoundField DataField="BookingId" HeaderText="Booking Id" SortExpression="BookingId"/>
            <asp:TemplateField HeaderText="Customer" SortExpression="CustomerId">
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# "<a href=\"CustomerFullView.aspx?cusId=" + Eval("CustomerId") + "\">" + CustomerBLL.GetCustomerName(Convert.ToInt32(Eval("CustomerId"))) + "</a>" %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="BookedDateTime" HeaderText="Booked date &amp; time" SortExpression="BookedDateTime"/>
            <asp:BoundField DataField="OriginDateTime" HeaderText="Pickup date &amp; time" SortExpression="OriginDateTime"/>
            <asp:TemplateField HeaderText="From">
                <ItemTemplate>
                    <asp:DetailsView ID="DetailsView2" Style="width: 100%;" CssClass="innerDetailsView"
                                     runat="server" CellPadding="4" DataSource='<%# new List<CurrentLocation> {(CurrentLocation) Eval("OriginLocation")} %>'
                                     ForeColor="#333333" GridLines="None" Height="50px" Width="125px" AutoGenerateRows="False">
                        <AlternatingRowStyle BackColor="White" ForeColor="#284775"/>
                        <CommandRowStyle BackColor="#E2DED6" Font-Bold="True"/>
                        <EditRowStyle BackColor="#999999"/>
                        <FieldHeaderStyle BackColor="#E9ECF1" Font-Bold="True"/>
                        <Fields>
                            <asp:BoundField DataField="HomeNumberOrName" HeaderText="No / Name"/>
                            <asp:BoundField DataField="Street" HeaderText="Street"/>
                            <asp:BoundField DataField="City" HeaderText="City"/>
                            <asp:TemplateField HeaderText="District">
                                <ItemTemplate>
                                    <asp:Label ID="Label1" runat="server" Text='<%# DistrictBLL.GetDistrict(Convert.ToByte(Eval("DistrictId"))) %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Fields>
                        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White"/>
                        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White"/>
                        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center"/>
                        <RowStyle BackColor="#F7F6F3" ForeColor="#333333"/>
                    </asp:DetailsView>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="Destination" HeaderText="To" SortExpression="Destination"/>
            <asp:BoundField DataField="Type" HeaderText="Type" SortExpression="Type"/>
            <asp:BoundField DataField="Status" HeaderText="Status" SortExpression="Status"/>
            <asp:TemplateField HeaderText="Supervisor">
                <ItemTemplate>
                    <%#  Eval("SupervisorId") == null ? "-" : "<a href='SupervisorFullView.aspx?staffId=" + Eval("SupervisorId") + "'>" + StaffBLL.GetStaffById(Convert.ToInt32(Eval("SupervisorId"))).FirstName + "</a>" %>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Vehicle(s)">
                <ItemTemplate>
                    <asp:GridView ID="GridView1" runat="server" DataSource='<%# Eval("VehicleDrivers") %>'
                                  AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333" GridLines="None">
                        <AlternatingRowStyle BackColor="White" ForeColor="#284775"/>
                        <Columns>
                            <asp:TemplateField HeaderText="Vehicle">
                                <ItemTemplate>
                                    <%# Eval("VehicleRegistrationNo") == null ? "-" : "<a href='VehicleFullView.aspx?regNo=" + Eval("VehicleRegistrationNo") + "'>" + Eval("VehicleRegistrationNo") + "</a>" %>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Type">
                                <ItemTemplate>
                                    <%# Eval("VehicleRegistrationNo") == null ? "-" : VehicleBLL.GetVehiclesByRegNo(Eval("VehicleRegistrationNo").ToString()).Type %>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Driver">
                                <ItemTemplate>
                                    <%# Eval("DriverId") == null ? "-" : "<a href='DriverFullView.aspx?staffId=" + Eval("DriverId") + "'>" + StaffBLL.GetStaffById(Convert.ToInt32(Eval("DriverId"))).FirstName + "</a>" %>
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                        <EditRowStyle BackColor="#999999"/>
                        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White"/>
                        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White"/>
                        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center"/>
                        <RowStyle BackColor="#F7F6F3" ForeColor="#333333"/>
                        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333"/>
                        <SortedAscendingCellStyle BackColor="#E9E7E2"/>
                        <SortedAscendingHeaderStyle BackColor="#506C8C"/>
                        <SortedDescendingCellStyle BackColor="#FFFDF8"/>
                        <SortedDescendingHeaderStyle BackColor="#6F8DAE"/>
                    </asp:GridView>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="TravelledDistance" HeaderText="Travelled Distance"
                            SortExpression="TravelledDistance" NullDisplayText="-"/>
            <asp:BoundField DataField="DeliveredDateTime"
                            HeaderText="Delivered date & time" SortExpression="DeliveredDateTime"
                            NullDisplayText="-"/>
        </Fields>
        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White"/>
        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White"/>
        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center"/>
        <RowStyle BackColor="#F7F6F3" ForeColor="#333333"/>
    </asp:DetailsView>
</asp:Content>